home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / c / tox.lha / tox / tox.h < prev    next >
C/C++ Source or Header  |  2002-10-20  |  4KB  |  130 lines

  1. /*-------------------------------------------------------------------------
  2.  * tox - an XML tokenizer
  3.  *
  4.  * Copyright (c) 2000 Eckhart Köppen
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  *-----------------------------------------------------------------------*/
  21.  
  22. /* $Id: tox.h,v 1.11 2002/05/01 03:14:34 koeppen Exp $ */
  23.  
  24. #ifndef __TOX_H
  25. #define __TOX_H
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. struct _parser_state;
  32.  
  33. typedef void (callback)(struct _parser_state *);
  34.  
  35. typedef struct _parser_state
  36. {
  37.     char *text;
  38.     int current;
  39.     int maxtext;
  40.     int char_width;
  41.     int swap_bytes;
  42.  
  43.     int state;
  44.  
  45.     char pump;
  46.     char *buffer;
  47.     int bcurrent;
  48.     int maxbuf;
  49.  
  50.     int squoteLevel;
  51.     int dquoteLevel;
  52.     int angleBracketLevel;
  53.  
  54.     callback *element_callback;
  55.     callback *attrname_callback;
  56.     callback *attrval_callback;
  57.     callback *word_callback;
  58.     callback *ws_callback;
  59.     
  60.     void *userdata;
  61. } parser_state;
  62.  
  63. #define STATE_ERROR             -2
  64. #define STATE_END               -1
  65. #define STATE_CONTENT            0
  66. #define STATE_STARTTAG_START     1
  67. #define STATE_REF_START          2
  68. #define STATE_CHARDATA           3
  69. #define STATE_ENDTAG_START       4
  70. #define STATE_STARTTAG_NAME      5
  71. #define STATE_REF_NAME           6
  72. #define STATE_ENDTAG_NAME        7
  73. #define STATE_STARTTAG_NAMEEND   8
  74. #define STATE_ENDTAG_NAMEEND     9
  75. #define STATE_ATTR_NAME         10
  76. #define STATE_ATTR_NAMEEND      11
  77. #define STATE_ATTR_VALSTART     12
  78. #define STATE_ATTR_VALDQUOT     13
  79. #define STATE_EMPTYTAG_END      14
  80. #define STATE_ATTR_VALDQUOT_REF 15
  81. #define STATE_ATTR_VDQ_REFNAME  16
  82. #define STATE_ATTR_VALSQUOT     17
  83. #define STATE_ATTR_VALSQUOT_REF 18
  84. #define STATE_ATTR_VSQ_REFNAME  19
  85. #define STATE_DTD_START         20
  86. #define STATE_MARKUPDECL_START  21
  87. #define STATE_CDATA             22
  88. #define STATE_CDATA_1ST_BRACKET 23
  89. #define STATE_CDATA_2ND_BRACKET 24
  90. #define STATE_PI                25
  91. #define STATE_PI_END_QMARK      26
  92. #define STATE_COMMENT           27
  93. #define STATE_COMMENT_1ST_DASH  28
  94. #define STATE_COMMENT_2ND_DASH  29
  95. #define STATE_REF_NUMBER        30
  96. #define    STATE_REF_HEX_NUMBER_1  31
  97. #define    STATE_REF_HEX_NUMBER    32
  98. #define STATE_REF_DEC_NUMBER    33
  99. #define STATE_WS_CONTENT        34
  100. #define STATE_WORD_CONTENT      35
  101. #define STATE_COMMENT_START_1ST 36
  102. #define STATE_DOCTYPE_D         37
  103. #define STATE_DOCTYPE_O         38
  104. #define STATE_DOCTYPE_C         39
  105. #define STATE_DOCTYPE_T         40
  106. #define STATE_DOCTYPE_Y         41
  107. #define STATE_DOCTYPE_P         42
  108. #define STATE_CDATA_BRACKET     43
  109. #define STATE_CDATA_C           44
  110. #define STATE_CDATA_D           45
  111. #define STATE_CDATA_A           46
  112. #define STATE_CDATA_T           47
  113. #define STATE_CDATA_A2          48
  114.  
  115. void tox_parse (parser_state *parser);
  116.  
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120.  
  121. #endif
  122.  
  123.  
  124. /*
  125.  * Local variables:
  126.  * c-basic-offset: 4
  127.  * tab-width: 4
  128.  * End:
  129.  */
  130.